package com.pinyoumei.app.adapter;

import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.pinyoumei.app.R;
import com.pinyoumei.app.bean.ShopItemBean;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2020-12-11.
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * 2020-12-11        Administrator             新增Person类
 * 2020-12-11        Administrator             增加sex属性
 */
public class ShopItemAdapter2 extends BaseQuickAdapter<ShopItemBean.ResultBean.GoodsListBean, BaseViewHolder> {
    public ShopItemAdapter2(int layoutResId, @Nullable List<ShopItemBean.ResultBean.GoodsListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ShopItemBean.ResultBean.GoodsListBean item) {

        RequestOptions placeholder = new RequestOptions().placeholder(R.mipmap.ic_error_loading);
        ImageView imageView = helper.getView(R.id.iv_bg);
        Glide.with(mContext).load(item.getPict_url()).apply(placeholder).into(imageView);

        helper.setText(R.id.tv_sale_num,"已售" + item.getSale_num());
        helper.setText(R.id.tv_title,  item.getTitle() + "");
        helper.setText(R.id.tv_shop_name,  item.getShop_name() + "");

        helper.setText(R.id.tv_price,  item.getQh_final_price() + "");

        helper.setText(R.id.tv_coupon_money,  "券 ¥ " + item.getCoupon_money());

        helper.setText(R.id.tv_pre_commission,  "分享赚 ¥ " + item.getPre_commission());

        TextView textView = helper.getView(R.id.tv_zk_final_price);
        textView.setText( "券 ¥ " + item.getZk_final_price());

        textView.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG); //中划线




    }
}
